home *** CD-ROM | disk | FTP | other *** search
- Short: A kind of "resource tracking" makes cleanup easier.
- Author: Tomi Ollila <too@cs.hut.fi>
- Uploader: too@cs.hut.fi
- Type: dev/c
-
- This library is public domain. Use it any way you want. I do :)
- No warranty of any kind is given.
-
- Rt library provides a way to "remember" what resources has been allocated
- for the task a program is doing. Then, at the end of program execution, one
- `delete' -call will go through a stack of allocated stuff and call their
- corresponding deallocation functions.
-
- The initial and final procedures one must do are quite simple:
-
- First, create an rt memory space. Currently this space is statically bound
- to the value programmer gives. Programmer must know/quess a value high
- enough for all stuff that rt must remember: This is done the following way:
-
- struct RT * rt;
-
- unless (rt = rt_Create(100)) /* #define unless(x) if (!(x)) */
- return 20;
-
- This allocates memory for 100 items that rt can remember.
-
- ...Now you can for example do the following thing (and then forget the
- thing alltogether):
-
- void closeLib(struct Library * base) { CloseLibrary(base); }
- ...
-
- unless (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37))
- return 20;
-
- rt_Add(rt, closeLib, DOSBase);
-
- but all this can be done easier by using the provided rt_CloseLib -function:
-
- unless (rt_CloseLib(rt, &DOSBase, "dos.library", 37))
- return 20;
-
-
- As you see, the rt -system takes a pointer to deallocation function and a
- data pointer to be given as an argument to that function. At the end of
- program execution, the following call will do all these deallocation
- function calls in reverse order they were installed.
-
- rt_Delete(rt);
-
-
- The library in current state provides the following functions:
-
- /* rt.c */
- struct RT * rt_Create(int size); /* creates an rt instance */
- struct RTNode * rt_Add(struct RT * rt, void * func, void * data);
- struct RTNode * rt_Delete(struct RT * rt);
-
- /* rt_remnode.c -- the function below deletes one node */
- void rt_RemNode(struct RT * rt, struct RTNode * node);
-
- /* rt_remdata.c -- the function below deletes one node searched by data ptr */
- void rt_Remdata(struct RT * rt, void * data);
-
- /* rt_remsome.c -- function deletes multiple entries ... */
- void rt_Remdata(struct RT * rt, void * ptr, ULONG flags);
-
- /* rt_exec/rt_openlib.c -- void * as libptr reduces compiler warnings */
- struct RTNode * rt_OpenLib(struct RT * rt, void * libptr,
- char * name, int version); */
-
- /* rt_exec/rt_allocmem.c -- void * as memptr reduces compiler warnings */
- struct RTNode * rt_AllocMem(struct RT * rt, void * memptr,
- ULONG size, ULONG flags);
-
- /* rt_dos/rt_open.c */
- struct RTNode * rt_Open(struct RT * rt, BPTR * file, char * name, int mode);
-
-
- See the test program in test directory of this archive. It demonstrates
- the way those rt_Rem* -functions work (1384 bytes long and it uses almost
- all the functions provided in the library).
-
- If you want to add your own rt functions to this library, please follow the
- convention I've been using in rt_exec/ and rt_dos/ directories. I will gladly
- add all your "wrappers" you want to be included in this public distribution
- of this library.
-
- All sources and this library is compiled w/ gcc only, since it was so easy
- to use gcc cross compiler at sun sparcstation while developing this library
- (21" monitor, X and Emacs19 rules).
-
- Well, This documentation should give you a start of trying and using this
- library. Please send me comments about the usability and everything you
- could think about this piece of work to the address too@cs.hut.fi.
-
- Tomi
-
-
- ============================= Archive contents =============================
-
- Original Packed Ratio Date Time Name
- -------- ------- ----- --------- -------- -------------
- 0 0 0.0% 01-Feb-95 02:40:00 rtlibrary/
- 0 0 0.0% 01-Feb-95 02:36:54 rtlibrary/include/
- 927 484 47.7% 01-Feb-95 00:14:56 rtlibrary/include/rt.h
- 429 276 35.6% 01-Feb-95 02:29:34 rtlibrary/include/rt_dos.h
- 539 327 39.3% 01-Feb-95 02:29:28 rtlibrary/include/rt_exec.h
- 0 0 0.0% 01-Feb-95 00:42:34 rtlibrary/lib/
- 2204 810 63.2% 01-Feb-95 01:46:16 rtlibrary/lib/librt.a
- 3541 1577 55.4% 01-Feb-95 02:39:46 rtlibrary/rtlibrary.readme
- 0 0 0.0% 01-Feb-95 02:35:54 rtlibrary/src/
- 1227 672 45.2% 01-Feb-95 00:41:58 rtlibrary/src/Makefile
- 0 0 0.0% 01-Feb-95 01:48:40 rtlibrary/src/rt/
- 900 449 50.1% 30-Jan-95 01:40:36 rtlibrary/src/rt/rt.c
- 324 235 27.4% 30-Jan-95 01:45:58 rtlibrary/src/rt/rt.o
- 647 386 40.3% 30-Jan-95 01:10:04 rtlibrary/src/rt/rt_priv.h
- 696 390 43.9% 07-Jan-95 00:33:08 rtlibrary/src/rt/rt_remdata.c
- 189 151 20.1% 01-Feb-95 00:42:06 rtlibrary/src/rt/rt_remdata.o
- 533 325 39.0% 07-Jan-95 00:33:08 rtlibrary/src/rt/rt_remnode.c
- 165 130 21.2% 30-Jan-95 01:36:48 rtlibrary/src/rt/rt_remnode.o
- 707 401 43.2% 01-Feb-95 01:40:16 rtlibrary/src/rt/rt_remsome.c
- 213 169 20.6% 01-Feb-95 01:40:24 rtlibrary/src/rt/rt_remsome.o
- 0 0 0.0% 01-Feb-95 01:48:40 rtlibrary/src/rt_dos/
- 574 333 41.9% 30-Jan-95 01:53:22 rtlibrary/src/rt_dos/rt_open.c
- 289 187 35.2% 01-Feb-95 00:42:14 rtlibrary/src/rt_dos/rt_open.o
- 0 0 0.0% 01-Feb-95 01:48:40 rtlibrary/src/rt_exec/
- 572 348 39.1% 01-Feb-95 01:45:34 rtlibrary/src/rt_exec/rt_allocmem.c
- 295 191 35.2% 01-Feb-95 01:46:10 rtlibrary/src/rt_exec/rt_allocmem.o
- 603 359 40.4% 01-Feb-95 01:45:16 rtlibrary/src/rt_exec/rt_openlib.c
- 295 194 34.2% 01-Feb-95 01:46:16 rtlibrary/src/rt_exec/rt_openlib.o
- 0 0 0.0% 01-Feb-95 01:46:36 rtlibrary/test/
- 1384 888 35.8% 01-Feb-95 01:46:36 rtlibrary/test/test1
- 1884 692 63.2% 01-Feb-95 01:47:36 rtlibrary/test/test1.c
- -------- ------- ----- --------- --------
- 19137 9974 47.8% 01-Feb-95 21:19:30 31 files
-